<!DOCTYPE html>
<html class="x-admin-sm">
<head>
<meta charset="UTF-8">
<title>公众号列表</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="__ADMIN__/css/font.css">
<link rel="stylesheet" href="__ADMIN__/css/xadmin.css">
<script type="text/javascript" src="__ADMIN__/js/jquery.min.js"></script>
<script type="text/javascript" src="__ADMIN__/lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="__ADMIN__/js/xadmin.js"></script>
<script type="text/javascript" src="__ADMIN__/js/cookie.js"></script>
<style>
.layui-btn+.layui-btn{
margin-left: 0;
}
</style>
</head>
<body>
    <div class="x-body x-admin">
      <xblock>
        <!--<button class="layui-btn" onclick="x_admin_show('新增','{:url('Wxapp/edit')}','','550','600')" >新增</button>-->
      </xblock>
      <div class="layui-card-body" style="padding-left: 0;float:left;padding-left:20px;padding-top:0;">
        <form class="layui-form layui-col-space5" action="" method="get">
            <div class="layui-inline layui-show-xs-block">
              <input style="width:260px;" type="text" name="keyword" id="keyword" value="" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
            {if condition="$list[0]['type'] eq '徐总'"}

            <!--<div class="layui-inline layui-show-xs-block">-->
            <!--  <select name="status" id="status">-->
            <!--    <option value="">全部</option>-->
            <!--    <option value="1" {:input('status')=='1'?'selected':''} >正常</option>-->
            <!--    <option value="2" {:input('status')=='2'?'selected':''} >警告</option>-->
            <!--    <option value="0" {:input('status')=='0'?'selected':''} >停用</option>-->
            <!--  </select>-->
            <!--</div>-->
            {/if}
            <div class="layui-inline layui-show-xs-block">
              <button class="layui-btn" id="search-btn">搜索</button>
            </div>
            
            <div class="layui-inline layui-show-xs-block">绑定开启活动数{$voteCount}</div>
        </form>
      </div>
      
      <div class="layui-table-body layui-table-main" style="width: 100%;">
      <table class="layui-table layui-form" lay-size="sm">
        <thead>
          <tr> 
            <th>公众号</th>
            <th>被封时间</th>
            <th>绑定管理员</th>
            <th>主体</th>
            <th>入口域名</th>
            <th>投票域名</th>
            <th style="width: 10%;text-align: center;">显示状态</th>
            <th style="text-align: center;">操作</th>
        </thead>
        <tbody>
          {volist name="list" id="value"}
          <tr {if condition="$value.red eq 1"}style="background:#f9ffa5"{/if}> 
            <td>{$value.name}-{$value.uniacid}</td>
            <td>{$value.last_time?date('Y-m-d H:i',$value.last_time):''}</td>
            <td>{$value.admin_name}</td>
            <td>{$value.company_name}</td>
            <td>{$value.enter_domain}</td>
            <td>{$value.yuming}</td>
            <td class="td-status" style="width: 10%;text-align: center;">
                <input type="checkbox" name="status" lay-skin="switch"  lay-text="显示|隐藏" {if condition="$value['status'] eq 1"}checked{/if} lay-filter="status" id="{$value.uniacid}" value="{$value.status}">
            </td>
            <td class="td-manage" style="text-align: center;">
              <a title="活动列表" class="layui-btn layui-btn-normal layui-btn-xs" onclick="x_admin_show('{$value.name}下的活动','{:url('Official/liveList',['uniacid'=>$value.uniacid])}','','860','600')"  href="javascript:;">
                活动列表
              </a>
              
              <a title="编辑" class="layui-btn layui-btn-normal layui-btn-xs" onclick="x_admin_show('编辑','{:url('Official/edit',['uniacid'=>$value.uniacid])}','','550','600')" href="javascript:;">
                编辑
              </a>
              
              {if session('group_id','','admin') eq 1}
              <a title="删除" class="layui-btn layui-btn-danger layui-btn-xs"  href="{:url('Official/del',['uniacid'=>$value.uniacid])}">
                删除
              </a>
              {/if}
            </td>
          </tr>
          {/volist}
        </tbody>
      </table>
      </div>
      
    </div>


<script>
layui.use(['form'], function(){
    form = layui.form;
    form.on('switch(status)', function(data){
      var obj=data.elem;
      var id = data.elem.id;
      var status = data.value;
      $.ajax({
          type:'POST',
          dataType:'json',
          data:{status:status,field:'status',uniacid:id},
          url:"{:url('Official/changeStatus')}",
          success:function(o){
            if(o.icon == 1){
              $(obj).attr('value',1);
            }else{
              $(obj).attr('value',0);
            }
            layer.msg(o.msg,{icon: o.icon,time:1000});
            location.reload();
          }
        });
    });
    form.on('switch(red)', function(data){
      var obj=data.elem;
      var id = data.elem.id;
      var status = data.value;
      $.ajax({
          type:'POST',
          dataType:'json',
          data:{status:status,field:'red',id:id},
          url:"{:url('Official/changeStatus')}",
          success:function(o){
            if(o.icon == 1){
              $(obj).attr('value',1);
            }else{
              $(obj).attr('value',0);
            }
            layer.msg(o.msg,{icon: o.icon,time:1000});
            location.reload();
          }
        });
    });
    
});

</script>
{if condition="$isSuper eq 1 "}
{/if}
</body>

</html>